home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / help.zip / HELPCONV / BRACE.C next >
C/C++ Source or Header  |  1991-12-26  |  562b  |  30 lines

  1. #include <stdio.h>
  2.  
  3. FILE *fp_in;
  4.  
  5. main( argc, argv)
  6.     int argc;
  7.     char *argv[];
  8.     {
  9.     int ii_brace = 0;
  10.     char ch;
  11.  
  12.     fp_in  = freopen( "out.rtf", "rt", stdin);
  13.  
  14.     while ( (ch = fgetc( fp_in)) != EOF )
  15.         {
  16.         switch( ch)
  17.             {
  18.             case '{':   ii_brace++; break;
  19.             case '}':   ii_brace--; break;
  20.             default:
  21.                 break;
  22.             }
  23.         }
  24.     if (ii_brace == 0)
  25.         printf( "Braces match\n");
  26.     else
  27.         printf( "Brace count %d\n", ii_brace);
  28.  
  29.     }    
  30.